<?php 

$username = array(
	"name"		=> "username",
	"id"		=> "username",
	"value"		=> set_value('username'),
	'class'		=> 'text-input medium-input'	
);

$email = array(
	"name"		=> "email",
	"id"		=> "email",
	"value"		=> set_value("email"),
	'class'		=> 'text-input medium-input'
);

$groups_opt = array(
);
if(isset($groups)){
	foreach($groups as $group){
		$groups_opt[$group->id] = $group->name;
	}
}
$group_value = set_value("group", $default_group->id);

$description = array(
	'name'	=> 'description',
	'id'	=> 'description',
	'value'	=> set_value('description')
);
?>



<div class="content-box"><!-- Start Content Box -->
				
	<div class="content-box-header">
		
		<h3>Añadir un nuevo Usuario</h3>
		
		<ul class="content-box-tabs">
			<li><a class="default-tab" href="#form-form">Formulario</a></li> <!-- href must be unique and match the id of target div -->
			<li><a href="#form-extra">Información Extra</a></li>
		</ul>
				
		<div class="clear"></div>
		
	</div> <!-- End .content-box-header -->
	
	<div class="content-box-content">
					
	<?php echo form_open($this->uri->uri_string()); ?>
	
		<fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
			
			<div id="form-form" class="default-tab tab-content">
				<p>
					<label>Usuario</label>
					<?php echo form_input($username); ?>
				</p>
				
				<p>
					<label>Email</label>
					<?php echo form_input($email); ?>
				</p>
				
				<p>
					<label>Contraseña</label>
					<?php echo form_password('password', '', 'class="text-input medium-input"'); ?>
				</p>
				<p>
					<label>Confirmación de contraseña</label>
					<?php echo form_password('passconf', '', 'class="text-input medium-input"'); ?>
				</p>
				
				<p>
					<label>Grupo</label>
					<?php echo form_dropdown('group', $groups_opt, $group_value); ?>
				</p>
				
				<p>
					<label>Notificar</label>
					<?php echo form_checkbox("notify", "true", TRUE); ?> ¿Desea notificar al usuario al correo que va a dar de alta?
				</p>
				
			</div>
			
			<div id="form-extra" class="tab-content" style="display: none">
				<?php foreach($additional_columns as $column):?>
		    	<p>
					<label><?php echo lang($column); ?></label>
					<?php echo form_input($column, set_value($column), 'class="text-input medium-input"'); ?>
				</p>
				<?php endforeach;?>
			</div>
			
			<p class="align-left">
				<input class="button" type="button" name="cancel" value="Cancelar" />
			</p>
			
			<p class="align-right">
				<input class="button" type="submit" value="Crear Usuario" />
			</p>

		</fieldset>
	
	<?php echo form_close(); ?>
	</div>
		
</div>

<script type="text/javascript">
	$(document).ready(function(){
		$("form *[name=cancel]").click(function(){
			window.location.href="<?php echo $referrer; ?>";
		})
	})
</script>
